package com.ibuonline.b2b.entity;

import java.io.Serializable;

public class ChannelAdvertise implements Serializable {

	private static final long serialVersionUID = -5141874048743692509L;

	//fields
	private java.lang.Integer id;
	private java.lang.String position;
	private java.lang.String type;
	private java.lang.String title;
	private java.lang.String link;
	private java.lang.String pic;
	private java.lang.String script;
	private java.lang.String channel;

	//default constructor
	public ChannelAdvertise() {
	}

	//getter
	public java.lang.Integer getId() {
		return id;
	}
	public java.lang.String getPosition() {
		return position;
	}
	public java.lang.String getType() {
		return type;
	}
	public java.lang.String getTitle() {
		return title;
	}
	public java.lang.String getLink() {
		return link;
	}
	public java.lang.String getPic() {
		return pic;
	}
	public java.lang.String getScript() {
		return script;
	}
	public java.lang.String getChannel() {
		return channel;
	}

	//setter
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public void setPosition(java.lang.String position) {
		this.position = position;
	}
	public void setType(java.lang.String type) {
		this.type = type;
	}
	public void setTitle(java.lang.String title) {
		this.title = title;
	}
	public void setLink(java.lang.String link) {
		this.link = link;
	}
	public void setPic(java.lang.String pic) {
		this.pic = pic;
	}
	public void setScript(java.lang.String script) {
		this.script = script;
	}
	public void setChannel(java.lang.String channel) {
		this.channel = channel;
	}

	//equals method
	public boolean equals(Object other) {
		if (this == other)
			return true;
		if (!(other instanceof ChannelAdvertise))
			return false;

		final ChannelAdvertise channelAdvertise = (ChannelAdvertise)other;
		if (!this.id.equals(channelAdvertise.getId()))
			return false;

		return true;
	}

	//hashCode method
	public int hashCode() {
		StringBuffer keys = new StringBuffer();
		keys.append(id).append(",");
		if (keys.length() > 0)
			keys.deleteCharAt(keys.length() - 1);
		return keys.toString().hashCode();
	}

	//toString method
	public String toString() {
		return new StringBuilder("ChannelAdvertise[")
			.append("id=").append(id).append(", ")
			.append("position=").append(position).append(", ")
			.append("type=").append(type).append(", ")
			.append("title=").append(title).append(", ")
			.append("link=").append(link).append(", ")
			.append("pic=").append(pic).append(", ")
			.append("script=").append(script).append(", ")
			.append("channel=").append(channel).append("]").toString();
	}
	///####
	public String getPicPath(){
		if (pic == null) {
            return null;
        }
        return com.ibuonline.b2b.common.ResourceUtil.getResPath(pic);
	}
}